/**
Group: efl/spin_button/vertical (@since 1.23)
	 Part Swallow: efl.dec_button (required)
	 Part Swallow: efl.entry (required)
	 Part Swallow: efl.inc_button (required)
	 Part Swallow: efl.text_button (required)
	 Signal: efl,button,visible,off
	 Signal: efl,button,visible,on
	 Signal: efl,entry,visible,off
	 Signal: efl,entry,visible,on
	 Signal: efl,state,access,active
	 Signal: efl,state,access,inactive
	 Signal: efl,state,disabled
	 Signal: efl,state,enabled
Group: efl/spin_button/horizontal/dec_button (@since 1.23)
	 Signal: efl,action,multi,down
	 Signal: efl,action,multi,up
	 Signal: efl,action,pressed
	 Signal: efl,action,unpressed
	 Signal: efl,state,animation,activated
	 Signal: efl,state,disabled
	 Signal: efl,state,enabled
Group: efl/spin_button/horizontal (@since 1.23)
	 Part Swallow: efl.dec_button (required)
	 Part Swallow: efl.entry (required)
	 Part Swallow: efl.inc_button (required)
	 Part Swallow: efl.text_button (required)
	 Signal: efl,button,visible,off
	 Signal: efl,button,visible,on
	 Signal: efl,entry,visible,off
	 Signal: efl,entry,visible,on
	 Signal: efl,state,access,active
	 Signal: efl,state,access,inactive
	 Signal: efl,state,disabled
	 Signal: efl,state,enabled
Group: efl/spin_button/vertical/text_button (@since 1.23)
	 Part Text: efl.text
	 Signal: efl,state,disabled
	 Signal: efl,state,enabled
Group: efl/spin (@since 1.23)
	 Part Text: efl.text
Group: efl/spin_button/horizontal/inc_button (@since 1.23)
	 Signal: efl,action,multi,down
	 Signal: efl,action,multi,up
	 Signal: efl,action,pressed
	 Signal: efl,action,unpressed
	 Signal: efl,state,animation,activated
	 Signal: efl,state,disabled
	 Signal: efl,state,enabled
Group: efl/spin_button/horizontal/text_button (@since 1.23)
	 Part Text: efl.text
	 Signal: efl,state,disabled
	 Signal: efl,state,enabled
Group: efl/spin_button/vertical/dec_button (@since 1.23)
	 Signal: efl,action,multi,down
	 Signal: efl,action,multi,up
	 Signal: efl,action,pressed
	 Signal: efl,action,unpressed
	 Signal: efl,state,animation,activated
	 Signal: efl,state,disabled
	 Signal: efl,state,enabled
Group: efl/spin_button/vertical/inc_button (@since 1.23)
	 Signal: efl,action,multi,down
	 Signal: efl,action,multi,up
	 Signal: efl,action,pressed
	 Signal: efl,action,unpressed
	 Signal: efl,state,animation,activated
	 Signal: efl,state,disabled
	 Signal: efl,state,enabled
*/
group { "efl/spin_button/horizontal";
   data.item: "version" "123";
   parts {
      rect { "clip";
         desc { "default";
            rel.to: "efl.text_button";
         }
      }
      rect { "bg";
         desc { "default";
            color_class: "/bg/normal/spinner/base";
         }
      }
      rect { "access";
         repeat;
         desc { "default";
            fixed: 1 1;
            color: 0 0 0 0; // no cc
            rel.to: "bg";
            hid;
         }
         desc { "active";
            inherit: "default";
            vis;
         }
      }
      swallow { "efl.entry"; required;
         clip: "clip";
         desc { "default";
            fixed: 1 1;
            rel.to: "efl.text_button";
            hid;
         }
         desc { "active";
            inherit: "default";
            vis;
         }
      }
      swallow { "efl.dec_button"; required;
         scale;
         desc { "default";
            fixed: 1 1;
            align: 0.0 0.5;
            min: 23 23;
            max: 23 23;
         }
      }
      swallow { "efl.inc_button"; required;
         scale;
         desc { "default";
            fixed: 1 1;
            align: 1.0 0.5;
            min: 23 23;
            max: 23 23;
         }
      }
      swallow { "efl.text_button"; required;
         scale;
         desc { "default";
            vis;
            rel1.to_y: "bg";
            rel1.to_x: "efl.dec_button";
            rel1.relative: 1.0 0.0;
            rel1.offset: 4 4;
            rel2.to_y: "bg";
            rel2.to_x: "efl.inc_button";
            rel2.relative: 0.0 1.0;
            rel2.offset: -5 -5;
            min: 23 0;
            max: -1 -1;
            offscale;
         }
         desc { "inactive";
            inherit: "default";
            hid;
         }
      }
      rect { "disabler";
         norepeat;
         nomouse;
         desc { "default";
            color: 0 0 0 0; // no cc
            hid;
         }
         desc { "disabled";
            inherit: "default";
            vis;
         }
      }
   }
   programs {
      program { "entry_active"; signal: "efl,entry,visible,on";
         source: "efl";
         action: STATE_SET "active";
         target: "efl.entry";
      }
      program { "entry_inactive"; signal: "efl,entry,visible,off";
         source: "efl";
         action: STATE_SET "default";
         target: "efl.entry";
      }
      program { signal: "efl,button,visible,on"; source: "efl";
         action: STATE_SET "default";
         target: "efl.text_button";
      }
      program { signal: "efl,button,visible,off"; source: "efl";
         action: STATE_SET "inactive";
         target: "efl.text_button";
      }
      program { signal: "efl,state,access,active"; source: "efl";
         action:  STATE_SET "active";
         target: "access";
      }
      program { signal: "efl,state,access,inactive"; source: "efl";
         action:  STATE_SET "default";
         target: "access";
      }
      program { signal: "efl,state,disabled"; source: "efl";
         action: STATE_SET "disabled";
         target: "disabler";
      }
      program { signal: "efl,state,enabled"; source: "efl";
         action: STATE_SET "default";
         target: "disabler";
      }
   }
}

group { "efl/spin_button/vertical";
   inherit: "efl/spin_button/horizontal";
   data.item: "version" "123";
   parts {
      part { name: "bg";
         desc { "default";
            min: 40 69;
         }
      }
      swallow { "efl.inc_button"; required;
         scale;
         desc { "default";
            rel.to: "bg";
            align: 0.5 0.0;
         }
      }
      swallow { "efl.dec_button"; required;
         scale;
         desc { "default";
            rel.to: "bg";
            align: 0.5 1.0;
         }
      }
      swallow { "efl.text_button"; required;
         scale;
         desc { "default";
            rel.to_x: "bg";
            rel1 {
               to_x: "bg";
               to_y: "efl.inc_button";
               relative: 0.0 1.0;
            }
            rel2 {
               to_x: "bg";
               to_y: "efl.dec_button";
               relative: 1.0 0.0;
            }
            fixed: 0 1;
         }
         desc { "inactive";
            inherit: "default";
            hid;
         }
      }
   }
}

group { "efl/spin_button/horizontal/inc_button";
   data.item: "version" "123";
   script {
      public mouse_down = 0;
      public multi_down = 0;
   }
   parts {
      part { name: "arrow.image";
         scale: 1;
         description { state: "default" 0.0;
            min: 15 15;
            max: 15 15;
            image.normal: "i-arrow-r";
            color_class: "/fg/normal/spinner/arrow";
            rel1.offset: 4 4;
            rel2.offset: -5 -5;
            offscale;
         }
         description { state: "pressed" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/spinner/arrow";
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/disabled/spinner/arrow";
         }
      }
      part { name: "over"; type: RECT;
         repeat_events: 1;
         scale;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
            min: 23 23;
         }
      }
      part { name: "disabler"; type: RECT;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
            visible: 0;
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
   }
   programs {
      program { signal: "mouse,down,1"; source: "over";
         script {
            if ((get_int(multi_down) == 0) &&
                (get_int(mouse_down) == 0)) {
                  set_int(mouse_down, 1);
                  run_program(PROGRAM:"button_press2");
            }
         }
      }
      program { name: "button_press2";
         action: SIGNAL_EMIT "efl,action,press" "";
         after: "button_press_anim";
      }
      program { name: "button_press_anim";
         action: STATE_SET "pressed" 0.0;
         target: "arrow.image";
      }
      program { signal: "mouse,up,1"; source: "over";
         script {
            if (get_int(mouse_down) == 1) {
                  set_int(mouse_down, 0);
                  run_program(PROGRAM:"button_unpress2");
                  run_program(PROGRAM:"button_unpress_anim");
            }
         }
      }
      program { name: "button_unpress2";
         action: SIGNAL_EMIT "efl,action,unpress" "";
      }
      program { name: "button_unpress_anim";
         action: STATE_SET "default" 0.0;
         target: "arrow.image";
      }
      program { signal: "mouse,clicked,1"; source: "over";
         script {
            if (get_int(multi_down) == 0) {
              run_program(PROGRAM:"button_click2");
            }
         }
      }
      program { signal: "efl,action,unpressed"; source: "efl";
         after: "button_unpress_anim";
      }
      program { signal: "efl,action,pressed"; source: "efl";
         after: "button_press_anim";
      }
      program { name: "button_click2";
         action: SIGNAL_EMIT "efl,action,click" "";
      }
      program { signal: "efl,state,animation,activated"; source: "efl";
         action: STATE_SET "pressed" 0.0;
         target: "arrow.image";
         after: "access_pressed_anim";
      }
      program { name: "access_pressed_anim";
         action: STATE_SET "default" 0.0;
         transition: DECELERATE 0.1;
         target: "arrow.image";
      }
      program { signal: "efl,state,disabled"; source: "efl";
         action: STATE_SET "disabled" 0.0;
         target: "arrow.image";
         target: "disabler";
      }
      program { signal: "efl,state,enabled"; source: "efl";
         action: STATE_SET "default" 0.0;
         target: "arrow.image";
         target: "disabler";
      }
      program { signal: "efl,action,multi,down"; source: "efl";
         script {
            set_int(multi_down, 1);
         }
      }
      program { signal: "efl,action,multi,up"; source: "efl";
         script {
            set_int(multi_down, 0);
         }
      }
   }
}

group { "efl/spin_button/horizontal/entry";
   alias: "efl/spin_button/vertical/entry";
   inherit: "efl/text";
   data.item: "version" "123";
}

group { "efl/spin_button/horizontal/dec_button";
   inherit: "efl/spin_button/horizontal/inc_button";
   data.item: "version" "123";
   parts {
      part { name: "arrow.image";
         description { state: "default" 0.0;
            image.normal: "i-arrow-l";
         }
         description { state: "pressed" 0.0;
            image.normal: "i-arrow-l";
         }
         description { state: "disabled" 0.0;
            image.normal: "i-arrow-l";
         }
      }
   }
}

group { "efl/spin_button/horizontal/text_button";
   alias: "efl/spin_button/vertical/text_button";
   data.item: "version" "123";
   parts {
      part { name: "bg";
         type: SPACER;
         scale: 1;
         description { state: "default" 0.0;
         }
      }
      part { name: "efl.text"; type: TEXT;
         scale: 1;
         description { state: "default" 0.0;
            color_class: "/fg/normal/spinner/text";
            rel.to: "bg";
            rel1.offset: 4 4;
            rel2.offset: -5 -5;
            offscale;
            text { font: FN; size: 10;
               min: 1 1;
               text_class: "spinner";
               ellipsis: -1;
            }
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0 ;
            color_class: "/fg/disabled/spinner/text";
         }
      }
      part { name: "over"; type: RECT;
         repeat_events: 1;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
      }
      part { name: "disabler"; type: RECT;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
            visible: 0;
         }
         description { state: "disabled" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
   }
   programs {
      program { signal: "mouse,clicked,1"; source: "over";
         script {
            run_program(PROGRAM:"button_click2");
         }
      }
      program { name: "button_click2";
         action: SIGNAL_EMIT "efl,action,click" "";
      }
      program { signal: "efl,state,disabled"; source: "efl";
         action: STATE_SET "disabled" 0.0;
         target: "disabler";
         target: "efl.text";
      }
      program { signal: "efl,state,enabled"; source: "efl";
         action: STATE_SET "default" 0.0;
         target: "disabler";
         target: "efl.text";
      }
   }
}

group { "efl/spin_button/vertical/inc_button";
   inherit: "efl/spin_button/horizontal/inc_button";
   data.item: "version" "123";
   parts {
      part { name: "arrow.image";
         description { state: "default" 0.0;
            image.normal: "i-arrow-u";
         }
         description { state: "pressed" 0.0;
            image.normal: "i-arrow-u";
         }
         description { state: "disabled" 0.0;
            image.normal: "i-arrow-u";
         }
      }
   }
}

group { "efl/spin_button/vertical/dec_button";
   inherit: "efl/spin_button/horizontal/dec_button";
   data.item: "version" "123";
   parts {
      part { name: "arrow.image";
         description { state: "default" 0.0;
            image.normal: "i-arrow-d";
         }
         description { state: "pressed" 0.0;
            image.normal: "i-arrow-d";
         }
         description { state: "disabled" 0.0;
            image.normal: "i-arrow-d";
         }
      }
   }
}
